package com.smasher.doc.operation;

import android.content.Context;
import android.content.res.Resources;

import com.smasher.core.other.WeakReferenceHandler;
import com.smasher.doc.R;
import com.smasher.doc.entity.CacheEntity;

import java.io.File;

public class WorkTaskReadRaw implements Runnable, OperationReadHelper.Callback {

    private final Resources resources;
    private final WeakReferenceHandler handler;
    private final OperationReadHelper operationReadHelper = new OperationReadHelper(this);

    public static final int MSG_END = 1001;

    public WorkTaskReadRaw(Context context, WeakReferenceHandler handler) {
        this.resources = context.getResources();
        this.handler = handler;
    }

    @Override
    public void run() {
        operationReadHelper.readDocFromRaw(resources, R.raw.template10181844);
    }

    @Override
    public void onReady(CacheEntity entity) {
        handler.sendMessage(handler.obtainMessage(MSG_END));
    }
}
